class Solution {
public:
    vector<vector<int>> combine(int n, int k) {
        vector<vector<int>>ans;
        for(int i=1;i<(1<<n);i++){
            vector<int>res;
            for(int j=0;j<20;j++){
                if(i&(1<<j))res.push_back(j+1);
            }
            if(res.size()==k)ans.push_back(res);
        }
        return ans;
    }
};